<template>
  <router-view></router-view>
</template>

<script>
import { newWebSocket } from '@/api/webSocket'
import { updateStatis } from '@/main.js'

export default {
  name: 'App',
  created () {
    // this.newWebSocket = newWebSocket({ onmessage: this.getWsMessage })
  },
  methods: {
    getWsMessage (_data) {
      const data = JSON.parse(_data)
      try {
        // 更新角标信息
        updateStatis(data)
      } catch (e) {
        console.log(e)
      }
    }
  },
  beforeDestroy () {
    this.newWebSocket.close()
  }
}
</script>
